
/**
 * 
 */
package helloWorld;
import com.threed.jpct.*;

/**
 * @author Mathias
 *
 */
public class Hello {

	public Hello(){

		World world = new World();
		world.setAmbientLight(58, 255, 50);
		world.setFogging(World.FOGGING_ENABLED);

		TextureManager.getInstance().addTexture("dummy", TextureManager.getInstance().getDummyTexture());

		Object3D box = Primitives.getBox(13f, 2f);
		box.setTexture("dummy");
		box.setEnvmapped(Object3D.ENVMAP_ENABLED);

		box.build();

		world.addObject(box);
		
		

		world.getCamera().setPosition(50, -50, -5);
		world.getCamera().lookAt(box.getTransformedCenter());
		
		FrameBuffer buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
		buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
		buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

		while (!org.lwjgl.opengl.Display.isCloseRequested()) {
			box.rotateY(0.01f);
			
			
			buffer.clear(java.awt.Color.WHITE);
			world.renderScene(buffer);
			world.draw(buffer);
			buffer.update();
			buffer.displayGLOnly();
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
		buffer.dispose();
		System.exit(0);

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Hello hello = new Hello();
	}

}
